import { deleteByPrimaryKeyForEbookArticlePhotos, selectByPrimaryKeyForEbookArticlePhotos, insertForEbookArticlePhotos, updateForEbookArticlePhotos, deleteByMapForEbookArticlePhotos,updateByMapForEbookArticlePhotos, getOneForEbookArticlePhotos,getAllForEbookArticlePhotos,queryPageForEbookArticlePhotos, countForEbookArticlePhotos, insertBatchForEbookArticlePhotos, deleteBatchForEbookArticlePhotos,updateBatchForEbookArticlePhotos } from '@/services/system/api_ebookarticlephotos';

export default {
    namespace: 'ebookarticlephotos',

    state: {
        data: {
            list: [],
            pagination: {},
        },
    },

    effects: {
            *delete_by_primarykey_for_ebookarticlephotos({ payload }, { call, put }) {
                const response = yield call(deleteByPrimaryKeyForEbookArticlePhotos, payload);
                yield put({
                    type: 'deleteByPrimaryKeyForEbookArticlePhotos',
                    payload: response,
                });

                const responsedata = yield call(queryPageForEbookArticlePhotos, {});
                yield put({
                type: 'queryPageForEbookArticlePhotos',
                payload: responsedata,
                });


            },
            *select_by_primarykey_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(selectByPrimaryKeyForEbookArticlePhotos, payload);
                yield put({
                    type: 'selectByPrimaryKeyForEbookArticlePhotos',
                    payload: response,
                });

                if (callback) callback();
            },
            *insert_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(insertForEbookArticlePhotos, payload);
                yield put({
                    type: 'insertForEbookArticlePhotos',
                    payload: response,
                });

                const responsedata = yield call(queryPageForEbookArticlePhotos, {});
                yield put({
                type: 'queryPageForEbookArticlePhotos',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *update_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(updateForEbookArticlePhotos, payload);
                yield put({
                    type: 'updateForEbookArticlePhotos',
                    payload: response,
                });


                const responsedata = yield call(queryPageForEbookArticlePhotos, {});
                yield put({
                type: 'queryPageForEbookArticlePhotos',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *delete_by_map_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(deleteByMapForEbookArticlePhotos, payload);
                yield put({
                    type: 'deleteByMapForEbookArticlePhotos',
                    payload: response,
                });


                const responsedata = yield call(queryPageForEbookArticlePhotos, {});
                yield put({
                type: 'queryPageForEbookArticlePhotos',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *update_by_map_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(updateByMapForEbookArticlePhotos, payload);
                yield put({
                    type: 'updateByMapForEbookArticlePhotos',
                    payload: response,
                });


                const responsedata = yield call(queryPageForEbookArticlePhotos, {});
                yield put({
                type: 'queryPageForEbookArticlePhotos',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *get_one_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(getOneForEbookArticlePhotos, payload);
                yield put({
                    type: 'getOneForEbookArticlePhotos',
                    payload: response,
                });

                if (callback) callback();
            },
            *get_all_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(getAllForEbookArticlePhotos, payload);
                yield put({
                    type: 'getAllForEbookArticlePhotos',
                    payload: response,
                });

                if (callback) callback();
            },
            *query_page_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(queryPageForEbookArticlePhotos, payload);
                yield put({
                    type: 'queryPageForEbookArticlePhotos',
                    payload: response,
                });


                if (callback) callback();
            },
            *count_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(countForEbookArticlePhotos, payload);
                yield put({
                    type: 'countForEbookArticlePhotos',
                    payload: response,
                });


                if (callback) callback();
            },
            *insert_batch_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(insertBatchForEbookArticlePhotos, payload);
                yield put({
                    type: 'insertBatchForEbookArticlePhotos',
                    payload: response,
                });


                const responsedata = yield call(queryPageForEbookArticlePhotos, {});
                yield put({
                type: 'queryPageForEbookArticlePhotos',
                payload: responsedata,
                });


                if (callback) callback();
            },
            *delete_batch_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(deleteBatchForEbookArticlePhotos, payload);
                yield put({
                    type: 'deleteBatchForEbookArticlePhotos',
                    payload: response,
                });

                const responsedata = yield call(queryPageForEbookArticlePhotos, {});
                yield put({
                type: 'queryPageForEbookArticlePhotos',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *update_batch_for_ebookarticlephotos({ payload, callback }, { call, put }) {
                const response = yield call(updateBatchForEbookArticlePhotos, payload);
                yield put({
                    type: 'updateBatchForEbookArticlePhotos',
                    payload: response,
                });

                const responsedata = yield call(queryPageForEbookArticlePhotos, {});
                yield put({
                type: 'queryPageForEbookArticlePhotos',
                payload: responsedata,
                });

                if (callback) callback();
            },
            },

    reducers: {
        deleteByPrimaryKeyForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        selectByPrimaryKeyForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        insertForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        updateForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        deleteByMapForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        updateByMapForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        getOneForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        getAllForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        queryPageForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        countForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        insertBatchForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        deleteBatchForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        updateBatchForEbookArticlePhotos(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
    },
};
